from elasticsearch import Elasticsearch

# 账号密码连接到Elasticsearch
# es = Elasticsearch(['http://192.168.173.46:9200'], basic_auth=('elastic', 'elastic'))
es = Elasticsearch(['http://192.168.175.86:9200'], basic_auth=('elastic', 'elastic'))

# 查询索引名为"assetszmd_test_"的所有文档
# categoryszmd_test_
response = es.search(index="categoryszmd_test_")
# response = es.search(index="assetszmd_test_")
# response = es.search(index="categorystest89")


# 获取所有索引
response = es.cat.indices(format='json')

# 打印返回的文档
print(response['hits']['hits'])